/*************************************************************************
> File Name: 01_test.cpp
> Author: hzy
> Created Time: 2023-08-17 16:39:44
> Description:
************************************************************************/
#include <iostream>

using namespace std;

class Person
{
private:
    int age;

public:
    Person(int myage) throw();
};

Person::Person(int myage) throw()
{
    if (myage < 0 || myage > 120)
    {
        throw out_of_range("超出年龄范围！");
    }
    age = myage;
}

void fun()
{
    throw out_of_range("test");
}
int main()
{
    try
    {
        Person person(140);
    }
    catch (const exception &e)
    {
        cerr << e.what();
    }

    return 0;
}